//
//  Event+Extension.swift
//  HinsLive
//
//  Created by haoxian on 2019/4/21.
//  Copyright © 2019 Hins. All rights reserved.
//

import Foundation
import RxSwift

extension Event where Element: NetworkModel {
    func process(onNext: (Element) -> Void) {
        if case .next(let value) = self {
            onNext(value)
        }
    }
    
    func process(onError: (NetworkError) -> Void) {
        if case .error(let error) = self, let netError = error as? NetworkError {
            onError(netError)
        }
    }
}
